package ruleta_wicket.ruleta_wicket;

import java.util.List;

import javax.swing.text.html.ListView;

import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.PropertyListView;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.PropertyModel;

import domain.Player;
import domain.Table;

public class ListPlayerPanel extends Panel { 

	
	public ListPlayerPanel() {
		super("ListPlayerPanel");

		Form form = new Form("listPlayerPanel");
		
		List<Player> players = (List<Player>) WicketApplication.getApplication().getTable().getPlayers();
		
		PropertyListView<Player> property = new PropertyListView("players",players){
			protected void populateItem(ListItem item) {
		        Player player = (Player) item.getModelObject();
		        item.add(new Label("name", player.getName()));
		    }
		}; 
		
		form.add(property);
		this.add(form);
	}

}
